<script src="http://protozoa.googlecode.com/svn/trunk/js/functions.js"></script>
<script src="http://protozoa.googlecode.com/svn/trunk/js/dom.js"></script>
<script src="http://protozoa.googlecode.com/svn/trunk/js/dom.event.js"></script>
<script src="http://protozoa.googlecode.com/svn/trunk/js/utils.js"></script>

<!--
<script src="/js/functions.js"></script>
<script src="/js/dom.js"></script>
<script src="/js/dom.event.js"></script>
<script src="/js/utils.js"></script>
<!---->

<style>body {font-size:11px} pre {font:11px mono;border-bottom:1px solid #ddd; padding-bottom:0.3em; margin:0.3em;}</style>

<script src='lex3.js'></script>
<script>


var text = load_file('lex3.js');
//var text_array = Array.prototype.slice.apply(text);

var f1 = function() {
	var count = 0;
	//var pat1 = 'function';
	//var pat2 = 'function';
	//var pl = Mapat.length;
	for (var i = 0, max = text.length ; i < max; ++i) {
		if (text.substr(i, 7)  == 'function')
			++count;
		else if (text.substr(i, 3)  == 'var')
			++count;
		else if (text.substr(i, 5)  == 'break')
			++count;
//		else if (text.substr(i, 6)  == 'result')
//			++count;
	}
	return count;
};

var count = 0;	

var l = {};
lex_merge(l, lex_re(parse_re('function'), function(){ ++count }));
lex_merge(l, lex_re(parse_re('var'), function(){ ++count }));
lex_merge(l, lex_re(parse_re('break'), function(){ ++count }));
//lex_merge(l, lex_re(parse_re('result'), function(){ ++count }));
lex_merge(l, lex_re(/./));


while (true) {
c0:
	switch (c[0]) {
		case 'f': 
c1:		
			switch (c[1]) {
				case 'u':
c2:		
					switch (c[2]) {
						case 'n':
c3:		
							switch (c[3]) {
								case 'c':
c4:		
									switch (c[4]) {
										case 't':
c5:		
											switch (c[5]) {
												case 'i':
c6:		
													switch (c[6]) {
														case 'o':
c7:		
															switch (c[7]) {
																case 'n':
																	/* action <function> */
																	break c0;
															}
															break c1;
													}
													break c1;
											}
											break c1;
									}
									break c1;
							}
							break c1;
					}
					break c1;
			}
			/* action <.> */
			break c0;
		
		
		
		case 'v':
		case 'b':
		default:
	}



trace(dump(l));

var out = [];

var compile = function(l, indent) {
	if (l.action)
	for (var i in l) {
		i == 'any' ? 'default' : 'case "' + i + '"'
	
	if ()
		out[out.length
	out[out.length] 
}




var f2 = function() {
	count = 0;
	lex_run(l, text);
	return count;
};


//alert(Array.prototype.slice.apply(x));

//alert(f2());


/*
var t0 = +new Date;
var result = f2();
var time = (+new Date) - t0;
alert('result: ' + result + '\ntime: ' + time);
/**/



//run_time_test(f2);



</script>




















